<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<canvas id="mycanvas" width="600px" height="600px"></canvas>
	</body>
	<script>
		//获取canvas
		let canvas = document.getElementById('mycanvas');
		//获取上下文
		let ctx = canvas.getContext('2d');
		//设置颜色
		ctx.fillStyle = 'blue'
		// 信号量
		let left = 100;
		
		setInterval(function(){
			//清除画布
			ctx.clearRect(0,0,600,600);
			left++
			ctx.fillRect(left,100,100,100)
		})
		
		console.log(ctx)
	</script>
</html>
